package cn.cs.service;

import cn.cs.mapper.QgTradeMapper;
import cn.cs.mapper.WithdrawalApplyMapper;
import cn.cs.pojo.QgTrade;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * yuexl
 */
@RestController
public class QgTradeService {
    private static final Logger logger = LoggerFactory.getLogger(QgTradeService.class);

    @Resource
    private QgTradeMapper qgTradeMapper;

    @RequestMapping(value = "/insertQgTrade", method = RequestMethod.POST)
    public Integer insertQgTrade(@RequestBody QgTrade qgTrade) throws Exception{
        return qgTradeMapper.insertQgTrade(qgTrade);
    }

    @RequestMapping(value = "/updateMoneyByType", method = RequestMethod.POST)
    public Integer updateMoneyByType(@Param(value = "money") String money, @Param(value = "type") String type) throws Exception{
        return qgTradeMapper.updateMoneyByType(money, type);
    }

    @RequestMapping(value = "/getFundsAccountByType", method = RequestMethod.POST)
    public Map<String, Object> getFundsAccountByType(@Param(value = "type") String type)throws Exception{
        return qgTradeMapper.getFundsAccountByType(type);
    }

    @RequestMapping(value = "/saveFundsCarryOver", method = RequestMethod.POST)
    public Integer saveFundsCarryOver(@RequestBody Map<String, Object> map)throws Exception{
        return qgTradeMapper.saveFundsCarryOver(map);
    }

    @RequestMapping(value = "/getFundsCarryOverByType", method = RequestMethod.POST)
    public List<Map<String, Object>> getFundsCarryOverByType(@Param(value = "type") String type)throws Exception{
        return qgTradeMapper.getFundsCarryOverByType(type);
    }

}
